﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate.Cfg;

namespace InnovTech.Data.NHibernate
{
    public abstract class ConfigurationBuilderBase : IConfigurationBuilder
    {
        public event EventHandler<NHibernateConfigurationBuildingEventArgs> Building;

        public Configuration Build()
        {
            Configuration config = new Configuration();
            OnBuilding(config);

            if (Building != null)
                Building(this, new NHibernateConfigurationBuildingEventArgs(config));
            return config;
        }

        protected abstract void OnBuilding(Configuration config);
    }

    public class NHibernateConfigurationBuildingEventArgs : EventArgs
    {
        public Configuration Configuration { get; set; }
        public NHibernateConfigurationBuildingEventArgs(Configuration config)
        {
            Configuration = config;
        }
    }
    
}
